<?php
namespace app\index\controller\traits;

trait Monster
{

/**
 * 佣兵表获取
 */
    function getMonsterArr($xml_file)
    {

        $xmlNode = simplexml_load_file($xml_file);
        $temp    = \app\ux\UtilXml::xmlToArray($xmlNode);
        $temp    = $temp ? $temp["RECORDS"]["RECORD"] : $temp;
        if ($temp) {
            $rtn = array();
            foreach ($temp as $k => $v) {
                $rtn[$v['id']]['name']       = $v['name'];
                $rtn[$v['id']]['quality']    = $v['quality'];
                $rtn[$v['id']]['location']   = $v['location'];
                $rtn[$v['id']]['need_angry'] = $v['need_angry'];
            }
        }
        return $rtn;
    }

}
